package com.gugee.common.web.system.promise.repository;


import com.gugee.common.web.system.promise.model.PermissionLimit;
import org.springframework.data.repository.CrudRepository;

import java.util.Optional;

public interface PermissionLimitRepository extends CrudRepository<PermissionLimit,Long> {

    Optional<PermissionLimit> findByPermissionIdAndProductIdAndAllow(long permissionId, long productId, String allow);

    Optional<PermissionLimit> findByPermissionIdAndProductId(long permissionId,long productId);

    Optional<PermissionLimit> findByPermissionIdAndProductIdAndLimitCountGreaterThanEqual(long permissionId,long productId,int limitCount);

    PermissionLimit findTop1ByPermissionIdAndProductId(long permissionId,long productId);
}
